package com.liang.socketupdown;

import java.io.*;
import java.net.Socket;

public class ClientSocket {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("192.168.13.64", 10086);

        BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("day_16\\timg.jpg"));

        int b;
        while ((b = bis.read()) != -1) {
            bos.write(b);
        }
        socket.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String str;
        while ((str = br.readLine())!=null) {
            System.out.println(str);
        }

        bis.close();
        socket.close();
    }
}
